import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test {
    // 1到 2023可以组成多少个2023
    // 算法原理：动态规划
    public static void main(String[] args) {
        StringBuilder s = new StringBuilder();
        for (int i = 1; i <= 2023; i++) {
            s.append(i);
        }
        long[] dp = new long[4];
        char[] chars = s.toString().toCharArray();
        for (int i = 0; i < s.length(); i++) {
            if (chars[i] == '2') {
                dp[0] += 1;
                dp[2] += dp[1];
            }
            if (chars[i] == '0') {
                dp[1] += dp[0];
            }
            if (chars[i] == '3') {
                dp[3] += dp[2];
            }
        }
        System.out.println(dp[3]);
    }

    public static void main30(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt(), b = in.nextInt();
        int a1 = Math.max(a, b), b1 = Math.min(a, b);
        int c = a1 % b1;
        while (c != 0) {
            a1 = b1;
            b1 = c;
            c = a1 % b1;
        }
        System.out.println((a * b) / b1);
    }

    public static int Fib(int n) {
        if (n == 1) {
            return 1;
        }
        if (n == 0) {
            return 0;
        }
        return Fib(n - 1) + Fib(n - 2);
    }

    public static void main29(String[] args) {
        int a = Fib(5);
        System.out.println(a);
    }

    public static void main28(String[] args) {
        StringBuilder str1 = new StringBuilder();
        StringBuilder str2 = new StringBuilder();
        Scanner in = new Scanner(System.in);
        String sb1 = in.nextLine();
        String sb2 = in.nextLine();
        str1.append(sb1);
        str2.append(sb2);
        for (int i = 0; i < str2.length(); i++) {
            for (int j = 0; j < str1.length(); j++) {
                if (str1.charAt(j) == str2.charAt(i)) {
                    str1.deleteCharAt(j);
                }
            }
        }
        System.out.println(str1);
    }

    public static void main27(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s = "";
        StringBuilder sb = new StringBuilder();
        int count = 0;
        while (n != 0) {
            count++;
            int tmp = n % 10;
            s = "" + tmp;
            sb.append(s);
            if (count % 3 == 0 && n / 10 != 0) {
                sb.append(",");
            }
            n /= 10;
        }
        for (int i = sb.length() - 1; i >= 0; i--) {
            System.out.print(sb.charAt(i));
        }
    }

    public static void main26(String[] args) {
        ExecutorService pool = Executors.newFixedThreadPool(10);
        pool = Executors.newCachedThreadPool();
        pool = Executors.newSingleThreadExecutor();
        pool = Executors.newScheduledThreadPool(10);

    }

    // 验证码
    public static void main25(String[] args) {
        String str = "0123456789zxcvbnmasdfghjklqwertyuiopZXCVBNMASDFGHJKLQWERTYUIOP";
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        ArrayList<String> arrayList = new ArrayList<>();
        int len = 5;
        while (len != 0) {
            for (int j = 0; j < 5; j++) {
                int i = random.nextInt(62);
                stringBuilder.append(str.charAt(i));
            }
            arrayList.add(String.valueOf(stringBuilder));
            stringBuilder.delete(0, 5);
            len--;
        }
        System.out.println(arrayList);
    }

    public static void main24(String[] args) {
        String s = String.valueOf(123);
        Test test = new Test();
        boolean flg = test.isPalindrome(100000001);
        System.out.println(flg);
        System.out.println(s);
    }

    // 判断一个数是不是回文数
    public boolean isPalindrome(int x) {
        int ret = 0;
        int tmp = x;
        if (x == 0) {
            return true;
        }
        if (x < 0) {
            return false;
        }
        while (tmp != 0) {
            ret = ret * 10 + tmp % 10;
            tmp /= 10;
        }
        return x == ret;
    }

    public static void main22(String[] args) {
        Test test = new Test();
        String s = "+-12";
        int a = test.myAtoi(s);
        System.out.println(a);
    }

    // 字符串转化为整数
    public int myAtoi(String s) {
        int carry = 0;
        int sign = 1;
        int i = 0;
        int tmp = Integer.MAX_VALUE / 10;
        if (s.isEmpty()) {
            return 0;
        }
        while (s.charAt(i) == ' ') {
            if (++i == s.length()) {
                return 0;
            }
        }
        if (s.charAt(i) == '-') {
            sign = -1;
        }
        if (s.charAt(i) == '+' || s.charAt(i) == '-') {
            i++;
        }
        for (int j = i; j < s.length(); j++) {
            if (s.charAt(j) < '0' || s.charAt(j) > '9') {
                break;
            }
            if (carry > tmp || carry == tmp && s.charAt(j) > '7') {
                return sign == 1 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
            }
            carry = carry * 10 + s.charAt(j) - '0';
        }
        return carry * sign;
    }

    public static void main21(String[] args) {
        Test test = new Test();
        int a = test.reverse(1534236469);
        System.out.println(a);
    }

    // 整数翻转,并且不能大于或小于int的32位子长
    public int reverse(int x) {
        int res = 0;
        while (x != 0) {
            //每次取末尾数字
            int tmp = x % 10;
            //判断是否 大于 最大32位整数
            if (res > 214748364 || (res == 214748364 && tmp > 7)) {
                return 0;
            }
            //判断是否 小于 最小32位整数
            if (res < -214748364 || (res == -214748364 && tmp < -8)) {
                return 0;
            }
            res = res * 10 + tmp;
            x /= 10;
        }
        return res;
    }

    public static void main20(String[] args) {
        Test test = new Test();
        int[] arr = {1, 8, 9};
        int[] arr1 = {4, 5, 6, 7, 8};
        double a = test.findMedianSortedArrays(arr, arr1);
        System.out.println(a);

    }

    // 返回两个正序数组的中位数
    public double findMedianSortedArrays(int[] nums1, int[] nums2) {
        int[] newNum = new int[nums1.length + nums2.length];
        System.arraycopy(nums1, 0, newNum, 0, nums1.length);
        System.arraycopy(nums2, 0, newNum, nums1.length, nums2.length);
        for (int i = 1; i < newNum.length; i++) {
            int tmp = newNum[i];
            int j = i - 1;
            for (; j >= 0; j--) {
                if (newNum[j] > tmp) {
                    newNum[j + 1] = newNum[j];
                } else {
                    break;
                }
            }
            newNum[j + 1] = tmp;
        }
        System.out.println(Arrays.toString(newNum));
        if (newNum.length % 2 != 0) {
            return newNum[newNum.length / 2];
        } else {
            return (double) (newNum[newNum.length / 2] + newNum[(newNum.length / 2) - 1]) / 2;
        }
    }

    public int[] twoSum(int[] nums, int target) {
        int[] num = new int[2];
        for (int i = 0; i < nums.length; i++) {
            int j = i + 1;
            for (; j < nums.length; j++) {
                if (nums[i] + nums[j] == target) {
                    num[0] = i;
                    num[1] = j;
                    return num;
                }
            }
        }
        return num;
    }

    private int a;
    private int b;

    private void swap(Test test) {
        int tmp = test.a;
        test.a = test.b;
        test.b = tmp;
    }

    public static void main19(String[] args) {
        Test test = new Test();
        test.a = 10;
        test.b = 20;
        test.swap(test);
        System.out.println(test.a);
        System.out.println(test.b);
    }

    public int FibonacciSequence(int x) {
        if (x == 1 || x == 2) {
            return 1;
        }
        return FibonacciSequence(x - 1) + FibonacciSequence(x - 2);
    }

    public static void main18(String[] args) {
        Test test = new Test();
        test.FibonacciSequence(5);
        for (int i = 1; i <= 5; i++) {
            System.out.println(test.FibonacciSequence(i));
        }
        //System.out.println(a);
    }

    public int Recursion(int x) {
        if (x == 1) {
            return 1;
        } else if (x < 1) {
            throw new RuntimeException("输入不合法！x= " + x);
        }
        return Recursion(x - 1) * x;
    }

    public static void main17(String[] args) {
        Test test = new Test();
        int a = test.Recursion(5);
        System.out.println(a);
    }

    // 杨辉三角
    public static List<List<Integer>> generate(int numRows) {
        // 创建整形数组List<>里面的对象是整形数组，用来存放ret数组
        List<List<Integer>> row = new ArrayList<List<Integer>>();
        // 控制杨辉三角的行数
        for (int i = 0; i < numRows; i++) {
            // 创建整形数组ret用来存放每一行的值
            List<Integer> ret = new ArrayList<Integer>();
            // 计算每一行的值
            for (int j = 0; j <= i; j++) {
                if (j == 0 || j == i) {
                    ret.add(1);
                } else {
                    // 将上一行左上角和右上角的值加起来得出当前行j下标的值
                    ret.add(row.get(i - 1).get(j - 1) + row.get(i - 1).get(j));
                }
            }
            row.add(ret);
        }
        System.out.println(row.get(numRows - 1));
        return row;
    }

    public static void main15(String[] args) {
        List<List<Integer>> a = generate(5);
        System.out.println(a);
    }

    public static void merge(int[] nums1, int m, int[] nums2, int n) {
        int k = m + n;
        int j = 0;
        for (int i = m; i < k; i++) {
            nums1[i] = nums2[j];
            j++;
        }
        for (int i = 0; i < nums1.length - 1; i++) {
            for (int l = 0; l < nums1.length - i - 1; l++) {
                if (nums1[l] > nums1[l + 1]) {
                    int temp = nums1[l];
                    nums1[l] = nums1[l + 1];
                    nums1[l + 1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(nums1));
    }

    public static void main14(String[] args) {
        int[] nums1 = {1, 2, 3, 0, 0, 0};
        int m = 3;
        int[] nums2 = {2, 5, 6};
        int n = 3;
        merge(nums1, 3, nums2, 3);
    }

    // 原地删除重复出现的元素，使每个元素只出现一次，返回删除后数组的新长度。元素的相对顺序应该保持一致，
    // 然后返回nums中唯一元素的个数。
    public static int removeDuplicates(int[] nums) {
        int a = 1;
        if (nums.length == 0) {
            return 0;
        }
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] != nums[i - 1]) {
                nums[a] = nums[i];
                a++;
            }
        }
        System.out.println(Arrays.toString(nums));
        return a;
    }

    public static void main13(String[] args) {
        int[] arr = {0, 0, 1, 1, 1, 2, 2, 2, 2, 3};
        int a = removeDuplicates(arr);
        System.out.println(a);
    }

    public static int removeElement1(int[] nums, int val) {
        int j = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != val) {
                nums[j] = nums[i];
                j++;
            }
        }
        System.out.println(Arrays.toString(nums));
        return j;
    }

    public static void main12(String[] args) {
        int[] arr = {3, 2, 2, 3};
        int a = removeElement1(arr, 3);
        System.out.println(a);
    }

    public static int removeElement(int[] nums, int val) {
        ArrayList<Integer> arrayList = new ArrayList<>(nums.length);
        for (int i : nums) {
            arrayList.add(i);
        }
        int j = 0;
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i) == val) {
                arrayList.remove(i);
                i--;
                j++;
            }
        }
        System.out.println(arrayList);
        return j;
    }

    public static void main11(String[] args) {
        int[] arr = {0, 1, 2, 2, 2, 2, 4, 2};
        int a = removeElement(arr, 2);
        System.out.println(a);
    }

    public static String rotate(int[] nums, int k) {
        int[] arr = new int[nums.length];
        int m = k % nums.length;
        int j = 0;
        if (m < arr.length) {
            for (int i = nums.length - m; i < nums.length; i++) {
                arr[j] = nums[i];
                j++;
            }
            for (int h = 0; h < nums.length - m; h++) {
                arr[j] = nums[h];
                j++;
            }
        }
        System.arraycopy(arr, 0, nums, 0, arr.length);
        return Arrays.toString(nums);
    }

    public static void main10(String[] args) {
        int[] arr = {1, 2};
        String s = rotate(arr, 4);
        System.out.println(s);
    }

    public static void main9(String[] args) {
        String str1 = "welcome to cctv";
        String str2 = "come";
        ArrayList<Character> str3 = new ArrayList<>();
        for (int i = 0; i < str1.length(); i++) {
            int count = 0;
            for (int j = 0; j < str2.length(); j++) {
                if (str1.charAt(i) == str2.charAt(j)) {
                    count++;
                }
            }
            if (count == 0) {
                str3.add((str1.charAt(i)));
            }
        }
        for (char x : str3) {
            System.out.print(x);
        }
    }

    public String mytolower(String s) {
        return s.toLowerCase();
    }

    public static void main8(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String s = scanner.nextLine();
            Test test = new Test();
            String s1 = test.mytolower(s);
            System.out.println(s1);
        }
    }

    public boolean abc(String str) {
        String str1 = str.toLowerCase();
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            char a = str.charAt(i);
            if (a >= 97 && a <= 122 || a >= 48 && a <= 57) {
                stringBuilder.append(a);
            }
        }
        String str2 = stringBuilder.toString();
        int left = 0;
        int right = str2.length() - 1;
        while (left < right) {
            if (str2.charAt(left) == str2.charAt(right)) {
                left++;
                right--;
            } else {
                return false;
            }
        }
        return true;
    }

    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        Test test = new Test();
        Boolean a1 = test.abc(s);
        System.out.print(a1);
    }

    public static void main6(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String str = scanner.nextLine();
            // split用空格来分割字符串，并放入一个新的字符串数组中
            String[] a = str.split(" ");
            System.out.println(a[a.length - 1].length());
        }
    }

    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int count = 0;
        for (int i = s.length() - 1; i >= 0; i--) {
            char a = s.charAt(i);
            if (a - ' ' != 0) {
                count++;
            } else break;
        }
        System.out.println(count);
    }

    // 使用计数数组模拟哈希表来确定字符串中第一个不重复出现的字符
    public int firstChar(String s) {
        int[] count = new int[26];
        for (int i = 0; i < s.length(); i++) {
            char a = s.charAt(i);
            count[a - 'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (count[ch - 'a'] == 1) {
                return i;
            }
        }
        return 0;
    }

    public static void main4(String[] args) {
        Test test = new Test();
        int a = test.firstChar("abcabt");
        System.out.println(a);
    }

    public static void main3(String[] args) {
        String str = "abccbate";
        for (int i = 0; i < str.length(); i++) {
            int count = 0;
            char a = str.charAt(i);
            for (int j = 0; j < str.length(); j++) {
                char c = str.charAt(j);
                if (a - c == 0) {
                    count++;
                }
            }
            if (count == 1) {
                System.out.print(i + " " + a);
                return;
            }
        }
    }

    public static void main2(String[] args) {
        long start = System.currentTimeMillis();
        System.out.println(start);
    }
}
